using System.Runtime.InteropServices;
using System.Data;
using System;
using MySql.Data.MySqlClient;
public class MysqlHerper{
    private MysqlHerper(){
        
    }
    private static MysqlHerper herper;
    public virtual void GetData(string sql,DataTable dt){
        using(MySqlConnection connection= SqlConFactory.GetConnection()){
                connection.Open();
            using(MySqlDataAdapter dataAdapter=new MySqlDataAdapter(sql,connection)){
               
                dataAdapter.Fill(dt);
            }
        }
    }
    public virtual bool Exquery(String sql){
        using(MySqlConnection connection=SqlConFactory.GetConnection()){
            using(MySqlCommand cmd=connection.CreateCommand()){
                connection.Open();
                cmd.CommandText=sql;
                return cmd.ExecuteNonQuery()>0;
            }
        }
    }

    public static MysqlHerper getHerper(){
        if(herper==null)herper=new MysqlHerper();
        return herper;
    }
}